package com.stress.testing.plugin.es.strategy;

import org.elasticsearch.action.termvectors.MultiTermVectorsRequest;
import org.elasticsearch.action.termvectors.TermVectorsRequest;

import java.util.Iterator;
import java.util.List;

public class MultiTermVectorsRequestIndexRenameStrategy extends AbstractRequestIndexRenameStrategy {
    @Override
    public void renameIndex(Object arg) {
        MultiTermVectorsRequest request = (MultiTermVectorsRequest) arg;
        List<TermVectorsRequest> requests = request.getRequests();
        Iterator<TermVectorsRequest> iterator = requests.iterator();
        while (iterator.hasNext()) {
            TermVectorsRequest req = iterator.next();
            req.index(internalRenameIndex(req.index()));
        }
    }
}